//
//  Status.swift
//  CXSwiftWB
//
//  Created by meidaeriOS on 2017/6/5.
//  Copyright © 2017年 meidaer. All rights reserved.
//

import UIKit

class Status: NSObject {
    /// 当前这条微博的发布时间
    var created_at: String?
    
    /// 来源
    var source: String?
    
    /// 字符串型的微博ID
    var idstr: String?
    
    /// 微博信息内容
    var text: String?
    
    /// 当前微博对应的用户
    var user: User?

    /// 存储所有配图字典
    var pic_urls: [[String: AnyObject]]?
    
    /// 转发微博
    var retweeted_status: Status?
    
    init(dict: [String: Any])
    {
        super.init()
        setValuesForKeys(dict)
    }
    
    override func setValue(_ value: Any?, forKey key: String) {
        if key == "user" && value != nil {
            user = User.init(value as! [String: Any])
            return
        }
        
        if key == "retweeted_status" && value != nil {
            retweeted_status = Status(dict: value as! [String: Any])
            return
        }
        super.setValue(value, forKey: key)
    }
    
    override func setValue(_ value: Any?, forUndefinedKey key: String) {
    }
}
